/**
 * Created with IntelliJ IDEA.
 * Description:区分一下构造器和getset方法
 * User: 杨已萱
 * Date: 2023-04-13
 * Time: 18:05
 */
class Test2 {
    private String name;


    public Test2() {

    }
    public Test2(String name) {
        this.name = name;
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
public class Test {
    public static void main(String[] args) {
        Test2 test2 = new Test2();
        //test2.name;//error ——>private
        test2.getName();
        test2.setName("yyx2");
        System.out.println(test2.getName());//不能打印set没有返回值
        String str2 = test2.getName();
        System.out.println(str2);
    }

}
